package view;

import com.edu.ViewResult;

import javax.servlet.ServletException;
import java.io.IOException;

public class ForwardViewResult extends ViewResult {

    private String url;

    public ForwardViewResult(String url){
        this.url = url;
    }

    @Override
    public void execute() {
        try {
            getRequest().getRequestDispatcher(this.url).forward(getRequest(),getResponse());
        } catch (ServletException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
